<template>
  <web-view :src="videoUrl"></web-view>
</template>

<script>
	import {
    cfCheckPointGetListByQueryApi
	} from '../../network/api.js'
  import {
    webRTCURL
  } from '../../common/config.js'

	export default {
		data() {
			return {
        videoUrl: '',
        checkPointId: '',
        token: '',
        uid: '',
			}
		},
		onLoad(e) {
      if (e.checkPointId) {
        this.checkPointId = e.checkPointId
      }
      if (e.token) {
        this.token = e.token
      }
      if (e.uid) {
        this.uid = e.uid
      }
			this.fenchData()
		},
		methods: {
			async fenchData() {
				const {
					data,
					code
				} = await cfCheckPointGetListByQueryApi({
					id: this.checkPointId,
				})
				if (code === 10002) {
          this.videoUrl = webRTCURL+"?checkPoint="+encodeURIComponent(JSON.stringify(data[0]))+"&token="+this.token+"&uid="+this.uid;
          console.log('地址', this.videoUrl);
				} else {

				}
			}
		}
	}
</script>